import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JFrame;
import javax.swing.JPanel;


public class Main extends JPanel implements MouseListener
{
	int m_x, m_y;
	public Main()
	{
		addMouseListener(this);
	}
	public static void main(String []args)
	{
		JFrame jf = new JFrame("pacMan");
		Main m = new Main();
		jf.add(m);
		jf.setVisible(true);
		jf.setSize(650, 650);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		g.fillRect(m_x, m_y, 30, 40);
	}
	public void mouseClicked(MouseEvent e)
	{
		m_x = e.getX(); m_y = e.getY(); repaint();
	}
	
	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}
